<?php
/**
 * 企业操作
 *
 */
class EnterpriseAction extends Action
{
	protected $Db;
	public $Config;
	
    function _initialize()
    {
        $this->Db = D('Enterprise');
        
		$Config = D('Config');
		$this->Config = $Config->find('config_id=1');
    }
	
    /**
     * Ajax获取东营汽车
     */
    public function GetCar()
    {
    	import('ORG.Util.HashMap');
    	$conditions = new HashMap();
    	$conditions->put('cid',array('EQ',40));
    	$conditions->put('re_id',array('EQ',4));
    	
    	$Car = $this->Db->where($conditions)
			    	->limit(10)
			    	->findall();
		//To tpl
		$this->assign('Car',$Car);
		$this->display();
    }
    /**
     * Ajax获取房产
     */
    public function GetHouse()
    {
    	import('ORG.Util.HashMap');
    	$conditions = new HashMap();
    	$conditions->put('cid',array('EQ',41));
    	$conditions->put('re_id',array('EQ',5));
    	
    	$Car = $this->Db->where($conditions)
			    	->limit(10)
			    	->findall();
		//To tpl
		$this->assign('Car',$Car);
		$this->display('GetCar');
    }
    /**
     * Ajax获取旅游
     */
    public function GetLvYo()
    {
    	import('ORG.Util.HashMap');
    	$conditions = new HashMap();
    	$conditions->put('cid',array('EQ',42));
    	$conditions->put('re_id',array('EQ',6));
    	
    	$Car = $this->Db->where($conditions)
			    	->limit(10)
			    	->findall();
		//To tpl
		$this->assign('Car',$Car);
		$this->display('GetCar');
    }
	/**
	 * 特色企业
	 */
	 function Tese(){
	 	//获取所有的特色企业分类
	 	$Class = D('Ecategory');
	 	$C = $Class->findall();
	 	
	 	$Input = Input::getInstance();
	 	$Input->filter('addslashes');
	 	
	 	//获取所有的特色企业
	 	import('ORG.Util.HashMap');
	 	$conditions = new HashMap();
	 	$conditions->put('re_id',array('EQ',1));
	 	if ($Input->get('cid') != '') {
	 		$conditions->put('cid',array('EQ',$Input->get('cid')));
	 	}
	 	//$Enterprise = $this->Db->where($conditions)->findall();
	 	$count = $this->Db->count($conditions,'enter_id');
	 	$listRows = 6;
	 	$fields = 'enter_id,domain,logo,name,enote';
	 	import('ORG.Util.Page');
	 	$p = new Page($count,$listRows);
	 	$list = $this->Db->findall($conditions,$fields,'enterprise_order desc,enter_id desc',$p->firstRow.','.$p->listRows);
	 	$page = $p->show();
	 	
	 	$this->assign('Enterprise',$list);
	 	$this->assign('page',$page);
	 	$this->assign('Class',$C);
	 	$this->assign('Config',$this->Config);
	 	$this->display();
	 }
	/**
	 * 代表
	 */
	 function Onfor(){
	 	//获取所有的企业分类
	 	$Class = D('Ecategory');
	 	$C = $Class->findall();
	 	
	 	$Input = Input::getInstance();
	 	$Input->filter('addslashes');
	 	
	 	//获取所有的企业
	 	import('ORG.Util.HashMap');
	 	$conditions = new HashMap();
	 	$conditions->put('re_id',array('EQ',3));
	 	if ($Input->get('cid') != '') {
	 		$conditions->put('cid',array('EQ',$Input->get('cid')));
	 	}
	 	
	 	$count = $this->Db->count($conditions,'enter_id');
	 	$listRows = 6;
	 	$fields = 'enter_id,domain,logo,name,enote';
	 	import('ORG.Util.Page');
	 	$p = new Page($count,$listRows);
	 	$list = $this->Db->findall($conditions,$fields,'enterprise_order desc,enter_id desc',$p->firstRow.','.$p->listRows);
	 	$page = $p->show();
	 	
	 	$this->assign('Enterprise',$list);
	 	$this->assign('page',$page);
	 	$this->assign('Class',$C);
	 	$this->assign('Config',$this->Config);
	 	$this->display();
	 }
	/**
	 * 市场商机
	 */
	 function Opp(){
	 	//获取所有的企业分类
	 	$Class = D('Ecategory');
	 	$C = $Class->findall();
	 	
	 	$Input = Input::getInstance();
	 	$Input->filter('addslashes');
	 	
	 	//获取所有的企业
	 	import('ORG.Util.HashMap');
	 	$conditions = new HashMap();
	 	$conditions->put('re_id',array('EQ',2));
	 	if ($Input->get('cid') != '') {
	 		$conditions->put('cid',array('EQ',$Input->get('cid')));
	 	}
	 	
	 	$count = $this->Db->count($conditions,'enter_id');
	 	$listRows = 6;
	 	$fields = 'enter_id,domain,logo,name,enote';
	 	import('ORG.Util.Page');
	 	$p = new Page($count,$listRows);
	 	$list = $this->Db->findall($conditions,$fields,'enterprise_order desc,enter_id desc',$p->firstRow.','.$p->listRows);
	 	$page = $p->show();
	 	
	 	$this->assign('Enterprise',$list);
	 	$this->assign('page',$page);
	 	$this->assign('Class',$C);
	 	$this->assign('Config',$this->Config);
	 	$this->display();
	 }
	/**
	 * 企业大全
	 */
	 function All(){
	 	//获取所有的企业分类
	 	$Class = D('Ecategory');
	 	$C = $Class->findall();
	 	
	 	$Input = Input::getInstance();
	 	$Input->filter('addslashes');
	 	
	 	//获取所有的企业
	 	import('ORG.Util.HashMap');
	 	$conditions = new HashMap();
	 	//$conditions->put('re_id',array('EQ',2));
	 	if ($Input->get('cid') != '') {
	 		$conditions->put('cid',array('EQ',$Input->get('cid')));
	 	}
	 	
	 	$count = $this->Db->count($conditions,'enter_id');
	 	$listRows = 6;
	 	$fields = 'enter_id,domain,logo,name,enote';
	 	import('ORG.Util.Page');
	 	$p = new Page($count,$listRows);
	 	$list = $this->Db->findall($conditions,$fields,'enterprise_order desc,enter_id desc',$p->firstRow.','.$p->listRows);
	 	$page = $p->show();
	 	
	 	$this->assign('Enterprise',$list);
	 	$this->assign('page',$page);
	 	$this->assign('Class',$C);
	 	$this->assign('Config',$this->Config);
	 	$this->display();
	 }
}
?>